#include <iostream>
#include <string>

using namespace std;

// demo1: variadic template
template <typename T, typename... Args>
void foo(const T &first, const Args &...args)
{
    cout << sizeof...(Args) << endl;
    cout << sizeof...(args) << endl;
}

// demo2: single parameter + variadic template to do print
template <typename T>
void print(const T &arg)
{
    cout << arg << endl;
}

template <typename T, typename... Args>
void print(const T &arg, const Args &...args)
{
    cout << arg << ",";
    print(args...);
}

int main()
{
    int i = 0;
    double d = 3.14;
    string s = "how now brown cow";
    foo(i, s, 42, d); // 3, 3
    foo(s, 42, "hi"); // 2, 2
    foo(d, s);        // 1, 1
    foo("hi");        // 0, 0

    // print
    print(1, 2, 3, "Hi! xy");
}